package org.dromara.demo.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.tenant.core.TenantEntity;

import java.io.Serial;

/**
 * 样例单表1对象 demo_example1
 *
 * @author wenrui Su
 * @date 2024-04-21
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("demo_example1")
public class DemoExample1 extends TenantEntity {

  @Serial
  private static final long serialVersionUID = 1L;

  @ExcelProperty(value = "主键")
  @TableId(value = "id")
  private Long id;

  @ExcelProperty(value = "名称")
  @NotBlank(message = "名称不能为空", groups = {AddGroup.class, EditGroup.class})
  private String name;

  @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
  @ExcelDictFormat(dictType = "sys_status")
  @NotBlank(message = "状态不能为空", groups = {AddGroup.class, EditGroup.class})
  private String status;

  @ExcelProperty(value = "排序号")
  private int sort;

  @ExcelProperty(value = "测试key")
  private String testKey;

  @ExcelProperty(value = "用户ID")
  private Long userId;

  @ExcelProperty(value = "值")
  private String value;

  @ExcelProperty(value = "乐观锁")
  @Version
  private Long version;

  @ExcelProperty(value = "删除标志")
  private Long delFlag;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "用户名称")
  @TableField(exist = false)
  private String userName;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "部门名称")
  @TableField(exist = false)
  private String deptName;


}
